#!/usr/bin/perl

my %heights = (
	short     => 200,
	medium    => 360,
	long      => 480,
	ludicrous => 600,
);

my $height = $ENV{QUERY_STRING};

if(!$height){
	($height) = $ENV{REQUEST_URI} =~ m|/([^/]+)/?$|;
}

$height = $heights{lc $height} || $height * 1 || 360;

my $xml;
{	local $/=undef;
	open(XML, 'jaiku.xml') || die("Unable to open source XML");
	$xml = <XML>;
	close(XML);
}

$xml=~s/^(\s*height=)"\d+"\s*$/$1"$height"/m;

print "Content-type: text/xml\n\n";
print $xml;
